package com.andengine.editor.atlaseditor;

import com.andengine.editor.data.TextureFile;
import java.util.ArrayList;
import java.util.List;

/**
 * @author sad
 */
public class Atlas {

    private long atlasId = -1;
    private TextureOptions textureOptions;
    private int atlasWidth;
    private int atlasHeight;
    private List<String> addedTextures;
    private List<SerializedTexture> textures;

    public long getAtlasId() {
        return atlasId;
    }

    public void setAtlasId(long sceneId) {
        this.atlasId = sceneId;
    }

    public TextureOptions getTextureOptions() {
        return textureOptions;
    }

    public void setTextureOptions(TextureOptions textureOptions) {
        this.textureOptions = textureOptions;
    }

    public int getAtlasWidth() {
        return atlasWidth;
    }

    public void setAtlasWidth(int atlasWidth) {
        this.atlasWidth = atlasWidth;
    }

    public int getAtlasHeight() {
        return atlasHeight;
    }

    public void setAtlasHeight(int atlasHeight) {
        this.atlasHeight = atlasHeight;
    }

    public List<String> getAddedTextures() {
        return addedTextures;
    }

    public void setAddedTextures(List<String> addedTextures) {
        this.addedTextures = addedTextures;
    }

    public List<SerializedTexture> getTextures() {
        return textures;
    }

    public List<TextureFile> getTextureFiles() {
        List<TextureFile> list = new ArrayList<>();
        for (SerializedTexture file : getTextures()) {
            list.add(new TextureFile(getAddedTextures().get(file.getIndex())));
        }

        return list;
    }

    public void setTextures(List<SerializedTexture> textures) {
        this.textures = textures;
    }

    public static class SerializedTexture {

        private int index;
        private int x;
        private int y;

        public int getIndex() {
            return index;
        }

        public void setIndex(int index) {
            this.index = index;
        }

        public int getX() {
            return x;
        }

        public void setX(int x) {
            this.x = x;
        }

        public int getY() {
            return y;
        }

        public void setY(int y) {
            this.y = y;
        }

    }
}
